package com.wsd.dao.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.wsd.bean.OrderList;
import com.wsd.dao.OrderListDaoInterface;

/**
 * A data access object (DAO) providing persistence and search support for
 * OrderList entities. Transaction control of the save(), update() and delete()
 * operations can directly support Spring container-managed transactions or they
 * can be augmented to handle user-managed Spring transactions. Each of these
 * methods provides additional information for how to configure it for the
 * desired type of transaction control.
 * 
 * @see com.wsd.bean.OrderList
 * @author MyEclipse Persistence Tools
 */

public class OrderListDAO extends HibernateDaoSupport implements OrderListDaoInterface {
	private static final Log log = LogFactory.getLog(OrderListDAO.class);
	// property constants
	public static final String _LNUM = "LNum";
	public static final String _LSUM_PRICE = "LSumPrice";
	public static final String _LPRICE = "LPrice";

	protected void initDao() {
		// do nothing
	}

	public void save(OrderList transientInstance) {
		log.debug("saving OrderList instance");
		try {
			getHibernateTemplate().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(OrderList persistentInstance) {
		log.debug("deleting OrderList instance");
		try {
			getHibernateTemplate().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public OrderList findById(java.lang.Integer id) {
		log.debug("getting OrderList instance with id: " + id);
		try {
			OrderList instance = (OrderList) getHibernateTemplate().get(
					"com.wsd.bean.OrderList", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(Object exampleEntity) {
		log.debug("finding by Products instances");
		try {
			return getHibernateTemplate().findByExample(exampleEntity);
		} catch (RuntimeException re) {
			log.error("find example failed", re);
			throw re;
		}
	}

	@SuppressWarnings("unchecked")
	public List<OrderList> findAll() {
		log.debug("finding all OrderList instances");
		try {
			String queryString = "from OrderList";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

}